home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / etc / init.d / anacron < prev    next >
Encoding:
Text File  |  2007-03-05  |  1.1 KB  |  52 lines

  1. #! /bin/sh
  2. # /etc/init.d/anacron: start anacron
  3. #
  4.  
  5. PATH=/bin:/usr/bin:/sbin:/usr/sbin
  6.  
  7. test -x /usr/sbin/anacron || exit 0
  8.  
  9. . /lib/lsb/init-functions
  10.  
  11. # Get lsb functions
  12. . /lib/lsb/init-functions
  13.  
  14. case "$1" in
  15.   start)
  16.     log_daemon_msg "Starting anac(h)ronistic cron" "anacron"
  17.     if test -x /usr/bin/on_ac_power 
  18.     then
  19.         /usr/bin/on_ac_power >/dev/null
  20.         if test $? -eq 1
  21.         then
  22.           log_progress_msg "deferred while on battery power."
  23.       log_end_msg 0
  24.       exit 0
  25.         fi
  26.     fi
  27.  
  28.     # on_ac_power doesn't exist, on_ac_power returns 0 (ac power being used)
  29.     # or on_ac_power returns 255 (undefined, desktop machine without APM)
  30.     start-stop-daemon --start --exec /usr/sbin/anacron -- -s
  31.     log_end_msg 0
  32.     ;;
  33.   restart|force-reload)
  34.     # nothing to do
  35.     :
  36.     ;;
  37.   stop)
  38.     log_daemon_msg "Stopping anac(h)ronistic cron" "anacron"
  39.     start-stop-daemon --stop --exec /usr/sbin/anacron --oknodo --quiet
  40.     log_end_msg 0
  41.     ;;
  42.   status)
  43.     exit 4
  44.     ;;
  45.   *)
  46.     echo "Usage: /etc/init.d/anacron {start|stop}"
  47.     exit 2
  48.     ;;
  49. esac
  50.  
  51. exit 0
  52.